package cn.edu.xust.api.controller;

import cn.edu.xust.entity.GatewayEntity;
import cn.edu.xust.service.GatewayService;
import cn.edu.xust.util.PageUtils;
import cn.edu.xust.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Date;
import java.util.Map;


/**
 *
 *
 * @author ufo
 * @email 2575829997@qq.com
 * @date 2024-03-27 18:09:23
 */
@RestController
@RequestMapping("api/gateway")
public class ApiGatewayController {
    @Autowired
    private GatewayService gatewayService;


    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody GatewayEntity gateway){

        gateway.setCtime(new Date());
		gatewayService.save(gateway);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody GatewayEntity gateway){
		gatewayService.updateById(gateway);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody GatewayEntity gateway){
		gatewayService.removeById(gateway.getId());

        return R.ok();
    }

}
